<template>
  <div class="nav">
    <div class="nav-item" v-for="(icon,index) in icons" :key='index'>
      <img :src="icon.imgUrl" alt>
      <p>{{icon.desc}}</p>
    </div>
  </div>
</template>
<script>
export default {
  props: {
    icons: Array
  },
  data() {
    return {};
  },
  computed: {
    pages() {
      var pages = [];
      this.icons.forEach((item, index) => {
          var page = Math.floor(index/8)
          if(!pages[page]){
              pages[page]=[]
          }
          
          pages[page].push(item);
      });
      return pages
    }
  }
};
</script>
<style lang="stylus" scoped>
.nav {
  display: flex;
  flex-wrap: wrap;
  width: 100%;
  height: 0;
  padding-bottom: 50%;

  .nav-item {
    width: 25%;
    height: 0;
    padding-bottom: 22%;
    text-align: center;
    box-sizing: border-box;
    padding-top: 0.2rem;

    img {
      width: 70%;
    }
  }
}
</style>

